package com.zl.zlbaseproject.base.fragment;

import android.content.Context;

import com.zl.zlbaseproject.base.presenter.BaseContract;

/**
 * Created by 郑磊 on 2018/6/17.
 */

public  abstract class BaseMvpFragment<P extends BaseContract.Presenter> extends BaseFragment implements BaseContract.View<P> {
    protected P mPresenter;



    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mPresenter = initPresenter();
    }

    /**
     * 初始化Presenter
     *
     * @return Presenter
     */
    protected abstract P initPresenter();

    @Override
    public void onDetach() {
        super.onDetach();
        if(mPresenter!=null){
            mPresenter.destroy();
            mPresenter=null;
        }
    }


    @Override
    public void showLoadingDialog() {

    }

    @Override
    public void dismissLoadingDialog() {

    }


}
